package handlers

import (
	"github.com/gin-gonic/gin"
	"lx/models"
	"net/http"
)

func CarAdd(c *gin.Context) {
	code := c.PostForm("code")
	name := c.PostForm("name")
	num := c.PostForm("num")

	car := models.Car{
		Code: code,
		Name: name,
		Num:  num,
	}

	models.DB.Create(&car)

	c.JSON(http.StatusOK, gin.H{
		"code": 500,
		"msg":  "添加成功",
		"data": car,
	})
	return
}
